//
//  IPViewController.swift
//  Wmsmobile
//
//  Created by wangshuning on 16/9/14.
//  Copyright © 2016年 www.hd123.com. All rights reserved.
//

import UIKit

import MMDrawerController

class IPViewController: UIViewController {
    
    @IBOutlet weak var vtextField: UITextField!
    @IBOutlet weak var stextField: UITextField!
    var drawerController: MMDrawerController?
    override func viewDidLoad() {
        super.viewDidLoad()
        
        
        // 自定义UINavigationBar
        stextField.text = ConfigGlobal.getRootIP().rootIP
        vtextField.text = ConfigGlobal.getRootIP().IPName
        vtextField.isUserInteractionEnabled = false
        stextField.isUserInteractionEnabled = false
        
        let nav = UINavigationBar.init(frame: CGRect(x: 0, y: 0, width: KscreenWidth, height: 64))
        UINavigationBar.appearance().barTintColor = UIColor.hexStringToUIColor("#00acff")
        let label = UILabel.init(frame: CGRect(x: 50, y: 20, width: KscreenWidth-120, height: 44))
        
        label.text = "设置服务器地址"
        label.textAlignment = NSTextAlignment.center
        label.textColor = UIColor.white
        label.font = UIFont.systemFont(ofSize: 17)
        //        label.backgroundColor = UIColor.redColor()
        let lbutton = UIButton.init(frame: CGRect(x: 15, y: 20, width: 44, height: 44))
        lbutton.setImage(UIImage(named: "返回"), for: UIControlState())
        //        lbutton.backgroundColor = UIColor.greenColor()
        lbutton.imageView?.contentMode = UIViewContentMode.scaleAspectFill
        lbutton.addTarget(self, action: #selector(IPViewController.back), for: UIControlEvents.touchUpInside)
        self.view.addSubview(nav)
        self.view.addSubview(label)
        self.view.addSubview(lbutton)

        // Do any additional setup after loading the view.
    }

    func back()  {
//            let  setVC = SetViewController()
//            self.navigationController?.pushViewController(setVC, animated: true)
        _ = self.navigationController?.popViewController(animated: true)
//        //设置中间视图
//        let app = UIApplication.sharedApplication()
//        let app2 = app.delegate;
//        let  setVC = SetViewController()
//        let  centerNVC = YunCenterViewController(rootViewController: setVC)
//        //设置左边抽屉视图
//        let leftVC = YunLeftTableViewController()
//        //对抽屉效果进行设置
//        drawerController = MMDrawerController.init(centerViewController: centerNVC, leftDrawerViewController: leftVC)
//        drawerController?.showsShadow = false
//        drawerController?.closeDrawerGestureModeMask = MMCloseDrawerGestureMode.All
//        drawerController?.maximumLeftDrawerWidth = 270
//        app2?.window!!.rootViewController = drawerController
    }
    
    override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
        super.init(nibName: "\(IPViewController.self)", bundle: nil)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
